<%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<html>
<head>
    <link href="<s:url value="resources/css/main.css"/>" rel="stylesheet" type="text/css"/>
    <title><s:text name="label.customers"/></title>
</head>
<body>

<table align=center>
<tr><td><h1 ><s:text name="label.custOrders"/> </h1></td></tr>
</table>
	<table width=600 align=center>
	    <tr> <s:url id="insert" action="custOrderSetUpForInsert"/>
	         <td><s:a href="%{insert}">Click Here to Add New Cust Order</s:a></td>
	     </tr>
	</table><br/>
<table align=center class="borderAll">
    <tr>
        <th><s:text name="label.custOrder.orderDate"/></th>
        <th><s:text name="label.custOrder.requiredDate"/></th>
        <th><s:text name="label.custOrder.shippedDate"/></th>
        <th><s:text name="label.customer.firstName"/></th>
        <th><s:text name="label.customer.lastName"/></th>
        <th><s:text name="label.salesman.firstName"/></th>
        <th><s:text name="label.salesman.lastName"/></th>
        <th colspan="5" ><s:text name="label.orderDetail"  /></th>
        <th><s:text name="label.payment.type"/></th>
        <th><s:text name="label.address.street"/></th>
        <th><s:text name="label.address.zipcode"/></th>
        <th>&nbsp;</th>
    </tr>
    <s:iterator value="custOrders" status="status">
        <tr class="<s:if test="#status.even">even</s:if><s:else>odd</s:else>">
            <td class="nowrap"><s:property value="orderDate"/></td>
            <td class="nowrap"><s:property value="requiredDate"/></td>
            <td class="nowrap"><s:property value="shippedDate"/></td>
            <td class="nowrap"><s:property value="customer.firstName"/></td>
            <td class="nowrap"><s:property value="customer.lastName"/></td>
            <td class="nowrap"><s:property value="salesman.firstName"/></td>
            <td class="nowrap"><s:property value="salesman.lastName"/></td>

            <td class="nowrap">
                              <table>
                              <s:iterator value="orderDetails" var="orderDetail" >
                                    <tr>
                                               <td class="nowrap"><s:property value="item.itemName"/></td>
                                               <td class="nowrap"><s:property value="item.itemDescription"/></td>
                                               <td class="nowrap"><s:property value="item.quantityInStock"/></td>
                                               <td class="nowrap"><s:property value="item.price"/></td>
                                               <td class="nowrap"><s:property value="quantity"/></td>
                                    </tr>

                             </s:iterator>
                             </table>
            </td>


           <td class="nowrap"><s:property value="shippingAddress.street"/></td>
           <td class="nowrap"><s:property value="shippingAddress.zipcode"/></td>
            <td class="nowrap">
                            	<s:url id="update" action="custOrderSetUpForUpdate">
            		       		   <s:param name="custOrder.orderId" value="id"/>
            		       		</s:url>
                            <s:a href="%{update}">Edit</s:a>
                            &nbsp;&nbsp;&nbsp;
                            <s:url id="delete" action="custOrderDelete">
            		       		   <s:param name="custOrder.orderId" value="id"/>
            		       		</s:url>
                            <s:a href="%{delete}">Delete</s:a>
                        </td>

        </tr>  		
	 </s:iterator>
    </table>
</body>
</html>
